(async function() { const chartData = { datasets: [{ label: 'ᐊᓄᕆᐅᑉ ᓴᓐᖏᓂᖓ', data: [{"x":0,"y":41.76},{"x":-1,"y":31.319999999999997},{"x":-2,"y":49.68000000000001},{"x":-3,"y":55.800000000000004},{"x":-5,"y":35.64},{"x":-7,"y":40.68000000000001},{"x":-10,"y":70.56},{"x":-11,"y":67.68},{"x":-13,"y":64.08},{"x":-14,"y":63.72},{"x":-15,"y":64.8},{"x":-16,"y":57.6},{"x":-17,"y":60.839999999999996},{"x":-18,"y":56.519999999999996},{"x":-19,"y":61.56000000000001},{"x":-20,"y":48.24},{"x":-21,"y":60.480000000000004},{"x":-22,"y":69.48},{"x":-23,"y":68.4},{"x":-24,"y":67.68}], backgroundColor: '#0053AA' }] } ctx = document.getElementById('windSpeed').getContext('2d'); chart = new Chart(ctx, { type: 'scatter', data: chartData, showLine: true, options: { scales: { x: { title: { display: true, text: 'ᐃᑲᕐᕋᑦ', font: { size: 16 }, } }, y: { title: { display: true, text: 'km/hr', font: { size: 16 }, } } } } }) if(chartData.datasets[0].data.length === 0) { const width = chart.width const height = chart.height const chart_ctx = chart.ctx; var fontSize = (height / 114).toFixed(2); chart_ctx.font = fontSize + "em sans-serif"; chart_ctx.fillStyle = "red"; chart_ctx.textBaseline = "middle"; var text = 'ᐊᑐᐃᓐᓇᐅᖏᑦᑐᖅ', textX = Math.round((width - ctx.measureText(text).width) / 2), textY = height / 2; ctx.fillText(text, textX, textY); } })();